// default package
// Generated 04.01.2014 16:35:54 by Hibernate Tools 4.0.0
package com.techtransteam.techtransteamWeb.dal.entities;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * UserRole generated by hbm2java
 */
@Entity
@Table(name = "user_role")
public class UserRole implements java.io.Serializable {

	private UserRoleId id;
	private User user;
	private Role role;

	public UserRole() {
	}

	public UserRole(UserRoleId id, User user, Role role) {
		this.id = id;
		this.user = user;
		this.role = role;
	}

	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "idUser", column = @Column(name = "id_user", nullable = false)),
			@AttributeOverride(name = "idRole", column = @Column(name = "id_role", nullable = false)) })
	public UserRoleId getId() {
		return this.id;
	}

	public void setId(UserRoleId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_user", nullable = false, insertable = false, updatable = false)
	public User getUsers() {
		return this.user;
	}

	public void setUsers(User user) {
		this.user = user;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_role", nullable = false, insertable = false, updatable = false)
	public Role getRoles() {
		return this.role;
	}

	public void setRoles(Role role) {
		this.role = role;
	}

}
